import request from "@/utils/request";
const userAllFavourite = (data) => {
    return request({
        url: `/api/favourite/user`,
        method: 'post',
        data
    });
};

// 添加收藏
const favouriteAdd = (data) => {
    return request({
        url: `api/favourite/add`,
        method: 'post',
        data
    });
};

// 创建默认收藏夹
const insertDefaultFolders = (userId) => {
    return request({
        url: `api/favourite/init/${userId}`,
        method: 'get'
    });
};

// 添加新的收藏夹
const insertFolder = (data) => {
    return request({
        url: `api/favourite/create`,
        method: 'post',
        data
    });
};

// 删除收藏夹
const deleteFolder = (folderId) => {
    return request({
        url: `api/favourite/delete/${folderId}`,
        method: 'get'
    });
};

// 删除收藏夹内的所有收藏项
const deleteFavoritesByFolderId = (folderId) => {
    return request({
        url: `api/favourite/clear/${folderId}`,
        method: 'get'
    });
};

// 删除指定收藏项
const removeFavorite = (data) => {
    return request({
        url: `api/favourite/remove`,
        method: 'post',
        data
    });
};

export {
    favouriteAdd,
    insertDefaultFolders,
    insertFolder,
    deleteFolder,
    deleteFavoritesByFolderId,
    removeFavorite,userAllFavourite
};
